package course.d1221;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/*
地铁案例
规则：从A站上车，到B站下车，计算付款金额
     0-6站           2元
     7-10站          3元
     11-14站         4元
     大于等于15站      5元
 */
public class d1221 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        List<String> list = new ArrayList<>();
        String[] arr = {"南岗", "桂庄路", "汽车西站", "振兴路", "蜀山西", "大蜀山",
                "天柱路", "科学大道", "十里庙", "西七里塘", "五里墩", "三里庵",
                "安农大", "三孝口", "四牌楼", "大东门"};
        for (String s : arr) {
            list.add(s);
        }
        System.out.println("请输入上车站点");
        String start = scanner.next();
        System.out.println("请输入下车站点");
        String end = scanner.next();
        //根据值找到索引
        int startIndex = list.indexOf(start);
        int endIndex = list.indexOf(end);
        if (startIndex!=-1 && startIndex!=-1){
            int count = Math.abs(startIndex - endIndex);
            if (count<=6){
                System.out.println("付款金额：2元");
            }else if(count<=10){
                System.out.println("付款金额：3元");
            }else if (count<=14){
                System.out.println("付款金额：4元");
            }else {
                System.out.println("付款金额 5元");
            }

        }
    }
}
